package com.bskj.kuaifu.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bskj.common.bean.model.NoCarnoParkRate;
import com.bskj.common.dao.NoCarnoParkRateDao;
import com.bskj.common.dao.core.BaseDao;
import com.bskj.common.dao.core.FindRequestEntity;
import com.bskj.common.dao.core.WhereEnum;
import com.bskj.common.service.impl.BaseServiceImpl;
import com.bskj.kuaifu.service.INoCarnoParkRateService;

@Service
public class NoCarnoParkRateServiceImpl extends BaseServiceImpl<NoCarnoParkRate> implements INoCarnoParkRateService {
	@Autowired
	private NoCarnoParkRateDao noCarnoParkRateDao;
	
	@Override
	public BaseDao<NoCarnoParkRate> getBaseDao() {
		return noCarnoParkRateDao;
	}

	@Override
	public NoCarnoParkRate getNoCarnoParkRate(Integer parkingLotId) throws Exception {
		FindRequestEntity findReq = new FindRequestEntity();
		findReq.addWhere("parking_lot_cust_id", WhereEnum.EQ, parkingLotId);
		List<NoCarnoParkRate> rateList = find(findReq);
		if(rateList != null && rateList.size() > 0) {
			return rateList.get(0);
		}
		return null;
	}
}
